package com.dmc.hrl.domain.entity;


import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 	分页返回的实体类
 * @author Peng
 *
 * @param <T>
 */
@ApiModel(value="分页结果对象模型")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PageResult<T> implements Serializable{
	
	@JSONField(ordinal = 1)
	@ApiModelProperty(value="页码",position = 1)
    private Integer pageNum;
	
	@JSONField(ordinal = 2)
	@ApiModelProperty(value="每页大小",position = 2)
    private Integer pageSize;
	
	@JSONField(ordinal = 3)
	@ApiModelProperty(value="总页数",position = 3)
    private Integer totalPage;
	
	@JSONField(ordinal = 4)
	@ApiModelProperty(value="总记录数",position = 4)
	private Long total; 
	
	@JSONField(ordinal = 5)
	@ApiModelProperty(value="每页的记录数据的集合",position = 5)
	private List<T> rows; 

	private static final long serialVersionUID = 1L;
	
	/**
	 * 	兼容旧版本的PageResult，新版本采用ResultEntity
	 * @param total
	 * @param rows
	 */
	public PageResult(long total, List<T> rows) {
		super();
		this.total = total;
		this.rows = rows;
	}

	
}
